from fastapi import Depends, Request, Response
from fastapi.routing import APIRoute
from afast_core.core_libs.classy_apirouter.group_router import RestInjectForAPIRouter, RestInjectForDocRouter
from infirmary_admin_src.infirmary_common.infirmary_controller import IBaseController
from afast_core.core_libs.classy_apirouter import IHookGroupBaseController
from afast_core.core_libs.classy_apirouter import get, post, put, delete
from infirmary_admin_src.infirmary_smart_admin.infirmary_biz.support.controllers.dict_key_add import \
    SupportDictKeyAddController
from infirmary_admin_src.infirmary_smart_admin.infirmary_biz.support.controllers.dict_key_delete import \
    SupportDictKeyDeleteController
from infirmary_admin_src.infirmary_smart_admin.infirmary_biz.support.controllers.dict_key_edit import \
    SupportDictKeyEditController
from infirmary_admin_src.infirmary_smart_admin.infirmary_biz.support.controllers.dict_key_query import \
    SupportDictKeyQueryController
from infirmary_admin_src.infirmary_smart_admin.infirmary_biz.support.controllers.dict_value_add import \
    SupportDictValueAddController
from infirmary_admin_src.infirmary_smart_admin.infirmary_biz.support.controllers.dict_value_delete import \
    SupportDictValueDeleteController
from infirmary_admin_src.infirmary_smart_admin.infirmary_biz.support.controllers.dict_value_edit import \
    SupportDictValueEditController
from infirmary_admin_src.infirmary_smart_admin.infirmary_biz.support.controllers.dict_value_query import \
    SupportDictValueQueryController
from infirmary_admin_src.infirmary_smart_admin.infirmary_biz.support.controllers.feedback_query import \
    SupportFeedbackQueryController
from infirmary_admin_src.infirmary_smart_admin.infirmary_biz.support.controllers.helpdoc_query import \
    SupportHelpDocQueryController
from infirmary_admin_src.infirmary_smart_admin.infirmary_biz.support.controllers.tablecolumn_getcolumns import \
    SupportTableColumnGetColumnsController


#  tags=['测试类装饰器依赖项']

@RestInjectForAPIRouter(prefix='/support')
@RestInjectForDocRouter(tags=['后台系统-登入日志模块'])
class AGroupAPIRouterBuilder(IHookGroupBaseController):
    # 定义公共全局的可用的服务，通过request对象进行透传当前的self

    async def before_request(self, curr_apiroute: APIRoute, request: Request) -> None:
        """如果需要修改请求信息，可直接重写此方法"""
        pass
        request.state.api_router_builder = self
        # 如果存在body对象的，在这里读取一下，以备后续的使用
        request.state.schema_param_body = await request.body()
        print("request.state.schema_param_body ", request.state.schema_param_body)

    async def after_request(self, request: Request, response: Response) -> None:
        """请求后的处理"""
        pass

    @post("/feedback/query", summary='support-feedback=获取通知信息')
    def admin_support_feedback_query(self, controller: IBaseController = SupportFeedbackQueryController):
        return controller.sync_response()

    @get("/helpDoc/queryHelpDocByRelationId/{RelationId}", summary='support-feedback=获取通知信息')
    def admin_support_helpDoc_queryHelpDocByRelationId(self,
                                                       controller: IBaseController = SupportHelpDocQueryController):
        return controller.sync_response()

    @get("/tableColumn/getColumns/{Id}", summary='support-feedback=获取通知信息')
    def admin_support_tableColumn_getColumns(self,
                                             controller: IBaseController = SupportTableColumnGetColumnsController):
        return controller.sync_response()

    @post("/dict/key/query", summary='support-dict=字典')
    def admin_support_dict_key_query(self, controller: IBaseController = SupportDictKeyQueryController):
        return controller.sync_response()

    @post("/dict/key/edit", summary='support-dict=字典')
    def admin_support_dict_key_edit(self, controller: IBaseController = SupportDictKeyEditController):
        return controller.sync_response()

    @post("/dict/key/add", summary='support-dict=字典添加')
    def admin_support_dict_key_add(self, controller: IBaseController = SupportDictKeyAddController):
        return controller.sync_response()

    @post("/dict/key/delete", summary='support-dict=字典添加')
    def admin_support_dict_key_delete(self, controller: IBaseController = SupportDictKeyDeleteController):
        return controller.sync_response()

    @post("/dict/value/query", summary='support-dict=字典')
    def admin_support_dict_value_query(self, controller: IBaseController = SupportDictValueQueryController):
        return controller.sync_response()

    @post("/dict/value/edit", summary='support-dict=字典')
    def admin_support_dict_value_edit(self, controller: IBaseController = SupportDictValueEditController):
        return controller.sync_response()


    @post("/dict/value/add", summary='support-dict=字典添加')
    def admin_support_dict_value_add(self, controller: IBaseController = SupportDictValueAddController):
        return controller.sync_response()


    @post("/dict/value/delete", summary='support-dict=字典添加')
    def admin_support_dict_value_delete(self, controller: IBaseController = SupportDictValueDeleteController):
        return controller.sync_response()
